/*
 * Copyright (c) 2019.11，华乘电气科技有限公司
 * All rights reserved.
 *
 * 文件名称：spectrumdatafileprivate.h
 * 
 * 初始版本：1.0
 * 作者：洪澄
 * 创建日期：2019/11/07
 * 摘要：图谱数据文件私有定义
 * 当前版本：1.0
 */

#pragma once

#include "spectrum.h"
#include <vector>

namespace DataSpecificationGW
{
    struct SpectrumsPrivate
    {
        std::vector<Spectrum*> vecSpectrum;
    };

    struct SpectrumDataFileHeadPrivate
    {
        friend class DataSpecification;

        qint32 iFileLength;
        QString qstrVersion;
        QString qstrGenerationTime;
        QString qstrStationName;
        QString qstrStationCode;
        quint8 ucWeather;
        float fTemperature;
        qint8 cHumidity;
        QString qstrInstrumentManufacturer;
        QString qstrInstrumentModel;
        QString qstrInstrumentVersion;
        QString qstrInstrumentSerialNumber;
        float fSystemFrequency;
        qint16 sSpectrumCount;
        QString qstrCompanyCode;
        QString qstrInternalVersion;

        void skipFileLength() { bSkipFileLength = true; }
        void skipVersion() { bSkipVersion = true; }
        void skipGenerationTime() { bSkipGenerationTime = true; }
        void skipStationName() { bSkipStationName = true; }
        void skipStationCode() { bSkipStationCode = true; }
        void skipWeather() { bSkipWeather = true; }
        void skipTemperature() { bSkipTemperature = true; }
        void skipHumidity() { bSkipHumidity = true; }
        void skipInstrumentManufacturer() { bSkipInstrumentManufacturer = true; }
        void skipInstrumentModel() { bSkipInstrumentModel = true; }
        void skipInstrumentVersion() { bSkipInstrumentVersion = true; }
        void skipInstrumentSerialNumber() { bSkipInstrumentSerialNumber = true; }
        void skipSystemFrequency() { bSkipSystemFrequency = true; }
        void skipSpectrumCount() { bSkipSpectrumCount = true; }
        void skipCompanyCode() { bSkipCompanyCode = true; }
        void skipInternalVersion() { bSkipInternalVersion = true; }

        bool hasFileLength() const { return bHasFileLength; }
        bool hasVersion() const { return bHasVersion; }
        bool hasGenerationTime() const { return bHasGenerationTime; }
        bool hasStationName() const { return bHasStationName; }
        bool hasStationCode() const { return bHasStationCode; }
        bool hasWeather() const { return bHasWeather; }
        bool hasTemperature() const { return bHasTemperature; }
        bool hasHumidity() const { return bHasHumidity; }
        bool hasInstrumentManufacturer() const { return bHasInstrumentManufacturer; }
        bool hasInstrumentModel() const { return bHasInstrumentModel; }
        bool hasInstrumentVersion() const { return bHasInstrumentVersion; }
        bool hasInstrumentSerialNumber() const { return bHasInstrumentSerialNumber; }
        bool hasSystemFrequency() const { return bHasSystemFrequency; }
        bool hasSpectrumCount() const { return bHasSpectrumCount; }
        bool hasCompanyCode() const { return bHasCompanyCode; }
        bool hasInternalVersion() const { return bHasInternalVersion; }

        SpectrumDataFileHeadPrivate();
        SpectrumDataFileHeadPrivate& operator=(const SpectrumDataFileHeadPrivate& stSpectrumDataFileHeadPrivate);
        bool operator==(const SpectrumDataFileHeadPrivate& stSpectrumDataFileHeadPrivate) const;

    private:
        bool bSkipFileLength;
        bool bSkipVersion;
        bool bSkipGenerationTime;
        bool bSkipStationName;
        bool bSkipStationCode;
        bool bSkipWeather;
        bool bSkipTemperature;
        bool bSkipHumidity;
        bool bSkipInstrumentManufacturer;
        bool bSkipInstrumentModel;
        bool bSkipInstrumentVersion;
        bool bSkipInstrumentSerialNumber;
        bool bSkipSystemFrequency;
        bool bSkipSpectrumCount;
        bool bSkipCompanyCode;
        bool bSkipInternalVersion;

        bool bHasFileLength;
        bool bHasVersion;
        bool bHasGenerationTime;
        bool bHasStationName;
        bool bHasStationCode;
        bool bHasWeather;
        bool bHasTemperature;
        bool bHasHumidity;
        bool bHasInstrumentManufacturer;
        bool bHasInstrumentModel;
        bool bHasInstrumentVersion;
        bool bHasInstrumentSerialNumber;
        bool bHasSystemFrequency;
        bool bHasSpectrumCount;
        bool bHasCompanyCode;
        bool bHasInternalVersion;
    };

    struct SpectrumDataFileTailPrivate
    {
        qint32 iCRC32;

        void skipCRC32() { bSkipCRC32 = true; }

        bool hasCRC32() const { return bHasCRC32; }

        SpectrumDataFileTailPrivate();
        SpectrumDataFileTailPrivate& operator=(const SpectrumDataFileTailPrivate& stSpectrumDataFileTailPrivate);
        bool operator==(const SpectrumDataFileTailPrivate& stSpectrumDataFileTailPrivate) const;

    private:
        bool bSkipCRC32;

        bool bHasCRC32;
    };
}
